Iterator 

image133.gif

The Iterator node is a next generation type of thinkingParticles nodes, it allows to Iterate or "loop" the evaluation of a particle setup. Similar to a Do or For loop in a programming language, this Node allows to call several times a network of nodes connected to it.

The use of this Node is endless and can be helpful in nearly every complex setup of an advanced particle system. Please check out the example presented at the end of this page, to learn more about the use of an Iterator node.

Operator Inputs 

ON - (Bool) This input data stream determines whether the operator is considered 'on' or 'off.' You can connect other operators to this input channel such as a Bool Helper to activate/deactivate the whole operator.

Time
- (Time) This input data stream is used to define the local time for the operator when the user wants to override the default system time.

Count
- (Integer) sets the number of iterations the Iterator should run through

Operator Outputs 

On - (Bool) this output is set active (True) as long as the current Iteration takes place.

Number
- (Integer) outputs the loop counter. This number represents the current position of the Iterator loop.

Number Normalize
- (Scalar) outputs the Iterator loop position in a normalized way (0-1). A value of 1 means that the end of the Iterator loop has been reached.

Width
- represents a fixed value that indicates the number of steps a loop will go through. This number is calculated by 1/Count, a good use of this value is to create averaged values by adding up Iteration loops.

Rollout Menu 

image134.gif

Count
- sets the number of loops to go through for this Iterator.

Example

 
image23.jpg

Scenario:

We would like to create a "ray shooter setup" to find an exit for particles out of a box room with a tiny hole in it. To do this we need to send several random rays form each particle position to test for a hole in the box. When a hole is found, the particles need to be sent in that direction.

Wiring:

The example above uses the Iterator node to loop through the connected nodes 20 times.

As you can see in the above example the Iterator activates the 3 Random helper nodes to create a randomized Vector pointing all around in the scene. With an Iterator node set to 20, a total of 20 different randomized vectors will be created. All Particles in the new Group will be evaluated 20 times as well and based on the result of the Intersect node, the particles are moved into a different Group to remove them from all further Iterations.

In the setup as seen above, the Intersect node is used to find a "No Intersection", this was achieved by using the Invert helper node connected to the Hit output port. So whenever, the Intersect does not create a result it will activate the Group switching and it will also use the vector to accelerate the particles so that they can move outside the box.